﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DTO;
using BUS;
using System.Collections.Generic;

public partial class KetQuaTimKiemSanPhamNC : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int pageSize = 5;
        String keyword = Request["keyword"];

        String loai = Request["loai"];
        String giaTu = Request["giaTu"];
        String giaDen = Request["giaDen"];
        String khuyenmai = Request["khuyenmai"];
        String currentPage = Request["currentPage"];
        int totalRow = SanPhamBus.LayTatCaSanPhamTimKiemNC(keyword, int.Parse(loai), int.Parse(giaTu), int.Parse(giaDen), khuyenmai);
        double totalPage = Math.Ceiling((float)totalRow / pageSize);
        txtTen.Value = keyword;
        cmbGiaTu.Value = giaTu;
        cmbGiaDen.Value = giaDen;
        cmbLoai.Value = loai;
        chkKhuyenMai.Value = khuyenmai;
        txtCurrentPage.Value = currentPage;
        txtTotalPage.Value = totalPage.ToString();
        List<SanPhamDto> sanpham = SanPhamBus.LayDanhSachSanPhamTimKiemNC(keyword, int.Parse(loai), int.Parse(giaTu), int.Parse(giaDen), khuyenmai, pageSize, int.Parse(currentPage));

        DataSanPhamTimKiem.DataSource = sanpham;
        DataSanPhamTimKiem.DataBind();
    }
}
